package com.qg.auth.handler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author QG
 * @Date 2023/5/25 10:57
 * @description 请求上下文
 **/
public class WebContext {
    /**
     * 请求上下文
     */
    private static final ThreadLocal<HttpServletResponse> response = new ThreadLocal<>();
    /**
     * 回复上下文
     */
    private static final ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();

    public static HttpServletResponse getResponse() {
        return response.get();
    }

    public static void setResponse(HttpServletResponse resp) {
        response.set(resp);
    }

    public static HttpServletRequest getRequest() {
        return request.get();
    }

    public static void setRequest(HttpServletRequest req) {
        request.set(req);
    }
}
